package www.lagou.dao;

import org.apache.commons.dbutils.QueryRunner;
import www.lagou.entity.Transaction;
import www.lagou.utils.DruidUtils;

import java.sql.SQLException;

public class TransactionDao {
public int addTransaction (Transaction transaction) throws SQLException {
    QueryRunner queryRunner=new QueryRunner(DruidUtils.getDataSource());
    String sql="insert into transaction(cardid,tratype,tramoney,tradate) value(?,?,?,?)";
    Object[] params={transaction.getCardid(),transaction.getTratype(),
    transaction.getTramoney(),transaction.getTradate()};
//return params;
return  queryRunner.update(sql,params);

}


}
